package com.CTAtracker.android.Models;

/**
 * This class represent the different color of the line of the CTA 
 */
public class ColorStation {
	/**
	 * Red
	 */
	public static final int RED = 0;
	/**
	 * Blue
	 */
	public static final int BLUE = 1;
	/**
	 * Green
	 */
	public static final int GREEN = 2;
	/**
	 * Brown
	 */
	public static final int BROWN = 3;
	/**
	 * Orange
	 */
	public static final int ORANGE = 4;
	/**
	 * Pink
	 */
	public static final int PINK = 5;
	/**
	 * Purple
	 */
	public static final int PURPLE = 6;
	/**
	 * Yellow
	 */
	public static final int YELLOW = 7;
	/**
	 * Congress
	 */
	public static final int CONGRESS = 8;

	/**
	 * The color of the line
	 */
	private int _color;

	/**
	 * Constructor, instantiate the color
	 * @param color the new color
	 */
	public ColorStation(int color) {
		_color = color;
	}

	/**
	 * Get the Textual color
	 */
	public ColorStation(String color) {
		if(color.equalsIgnoreCase("RED")){
			_color = RED;
		}else if(color.equalsIgnoreCase("BLUE")){
			_color = BLUE;
		}else if(color.equalsIgnoreCase("GREEN")){
			_color = GREEN;
		}else if(color.equalsIgnoreCase("BROWN")){
			_color = BROWN;
		}else if(color.equalsIgnoreCase("ORANGE")){
			_color = ORANGE;
		}else if(color.equalsIgnoreCase("PINK")){
			_color = PINK;
		}else if(color.equalsIgnoreCase("PURPLE")){
			_color = PURPLE;
		}else if(color.equalsIgnoreCase("YELLOW")){
			_color = YELLOW;
		}else if(color.equalsIgnoreCase("CONGRESS")){
			_color = CONGRESS;
		}
	}

	public ColorStation(ColorStation color) {
		_color = color.getColor();
	}

	/**
	 * Get the name of the line : "'Color' Line"
	 * @return the string of the name
	 */
	public String getStationName(){
		switch(_color){
		case RED:
			return "Red Line";
		case BLUE:
			return "Blue Line";
		case BROWN:
			return "Brown Line";
		case GREEN:
			return "Green Line";
		case ORANGE:
			return "Orange Line";
		case PINK:
			return "Pink Line";
		case PURPLE:
			return "Purple Line";
		case YELLOW:
			return "Yellow Line";
		case CONGRESS:
			return "Congress Line";
		default:
			return "No Line";
		}
	}

	/**
	 * Get the android value of the color : "#000000"
	 * @return the value of the color 
	 */
	public String toString() {
		String col = "";

		switch (_color)
		{
		case RED:
			col = "#c60c30";
			break;
		case BLUE:
			col = "#00a1de";
			break;
		case BROWN:
			col = "#62361b";
			break;
		case GREEN:
			col = "#009b3a";
			break;
		case ORANGE:
			col = "#f9461c";
			break;
		case PINK:
			col = "#e27ea6";
			break;
		case PURPLE:
			col = "#522398";
			break;
		case YELLOW:
			col = "#f9e300";
			break;
		case CONGRESS:
			col = "#565a5c";
			break;
		}

		return col;
	}

	/**
	 * Get the API value of the color "Red, Blue, Brn, G, Org, Pink, P, Y"
	 * @return the API Value of the color
	 */
	public String getColorAPI() {
		switch(_color){
		case RED:
			return "Red";
		case BLUE:
			return "Blue";
		case BROWN:
			return "Brn";
		case GREEN:
			return "G";
		case ORANGE:
			return "Org";
		case PINK:
			return "Pink";
		case PURPLE:
			return "P";
		case YELLOW:
			return "Y";
		case CONGRESS:
			return "C";
		default:
			return "No Line";
		}
	}

	public int getColor() {
		return _color;
	}
}
